﻿package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016102400749991";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQColE4zZtI0CbSbIU3a7cvSi8LWFZyRrf6czw7igQyHUqWXL+e9Au+zHL/XU0Eaiy7M5qMsmnHCzKzoTqmdCBkhndYWI702D9wsvvucpnzyyesXdot7r7Q5IT/pmaPAuUj/oyiHyUg8Yajhxud0uvYawZOFint7xS6eeL9GtnC+8lBtvquhfE3jLIgOdAR4RM8i3c2u2WC6st4HoT6ucUsxpKdjkyhMsGrJUqwoAcqg3vWwbPETifZJH06RduUtpMklFdS5tBiyGgI+y1uxjVbMXp/CU4jgEQqx9Ysg011cnuctHQQCz+fQLx2SUtRgHmOuxllHPUUdusFf7wziH1XPAgMBAAECggEAXRU+tN0ydi9hvUK/dYJWSBSJ6aIXSM1VSIqAQotVOqdk7b0y7UfgyPq35xJ+YUS2+8biFK/W3uQbGU7OEvo0vj4jxyfGw0IwpbhywEWhuoHJwLPhQtN65Qy5+KewJqtoZldV+twmecjG8pvck7TkTVPTvCoCEw6GtlQf8dCtIpFMV4uhQwVGxR9uDsHspK7/+Ym2IXy37WBk0C1FNMZAuwu/Ikfj2ekW/wIM+pKc/eJfUx7bH0y5YiG7lIocfw6EPzg30HEODxp9D2wtwMQ+yHppwzEawZtnmtYCmjuY2gipQXVz/ABbXMlSWPluiDhpMldRAMKywIlZINLzsMHleQKBgQDt34+X2h8lJkjzaaoxIpUNw0sJGwl93YckCv7KMuEN0QGnfANdIn3FdH/ow7eYOKZAOY5kwhUq/duO00EbpTFZsBHi9BtqLbxyCaktJQHs95MIKjb7A6mVSdiXwCQniLu7xTE00kd9ChtUKAO6dfYnWRi5HwDHi/k4z7kaJP+NVQKBgQC1bPSv09p51BWb+K7yepT1yJK/voOURGBdkgX5dYwG5UyDpnTGkzIqWZOyBRCQrTN46x7+bTP1toEM5rLpSBTJCqf4asbTAWh2uCC5KEs1rIUAoUuFbiuWN0RvyvQ/lfna4KseQ3uRRXtTgwdDugQ7Niwl7s8IRlXinma+V0x2kwKBgQDbDcVuUa/cxiToA6Z3GSGqSu4OtJdJEXgh+P4ptjEKSC79zXZLjjfEXkRsVc/8ni57doVqxFA6BwzpuiF7E+UecsYF+kZEwVmIqtzgdfQQBO2h1z5KalUA5cBP/uFMht5bTHzD5+FthKEmHrNQQtEr6yCZWbOeD4iyiJgtO2UbAQKBgQCTpOXEKW6E8rnbQphtMKEFHIOAk7RU9whNXcaK6sRX4EdSZCZoa+XJXTi7CTAf7TQUVZPVjl1Yu3tuWliDTGvN6GQl4A+KLH0tEE9hH4+FUK60go8JOU0zZCrHp6z6Cj1ZiLj5WgW3hYoFvn4s+bbz0PRAsoW9wC+oyyvl/vl1DQKBgGaFJiIfw0p2PGz8nrmj0IA4NAaGUXFolJ/tjO4iaEi+Om4Gyp5+eOb39wnPSp0jWRlYF9mTjqPxYDhhkgxDRGcLmlMncjz6m449qb/vzwJ4PM9pz6Zda5JYaXOJoWVgUkbul+Qmyt0l0GrmipTTAaYsJ4GWCe6BryhGgZj8ofMT";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAia9BYKx1pm8Bs6I/17sFSGF4pjLGuZe4RCuhJVSa2ksNjNNyeWHmO5cAKy7xhjrF8FSM9sfravXW6y+JU3DWtYzkH3dlmfVRtzLjylC2D7UISK6Z9Nc3tBQ5BV2rgYW5VqKcRl7wUKBP0vWtUBjOSc6ay3xLK/sGoxZSCC3Sng/p+QyHsApvNmLxwfIh/cW7guvFiGwdXLl831GNJEl7q4MF6wJiVCSjYE9G9YoupZwBCgq9ZLMKBwBPAVA+bnTBJ/AUyu6PMFIppfze80uVasIvXjr7+S1BQUduns38ALjGD41o1MaLfS1ti8p6N97urzsAgTek7X8clPdt2v8ALQIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://jia.mynatapp.cc/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://jia.mynatapp.cc/alipay.trade.page.pay-JAVA-UTF-8/return_url.jsp";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

